//
//  Path.swift
//  FearfulNotification
//
//  Created by 筱鹏 on 2017/8/24.
//  Copyright © 2017年 筱鹏. All rights reserved.
//

import UIKit

struct Path {

    static func documentPath() -> String {
        let dicumentPath = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.userDomainMask, true).last
        guard let path = dicumentPath else { return "" }
        return path
    }
    
    static func cachePath() -> String {
        let cachePath = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.cachesDirectory, FileManager.SearchPathDomainMask.userDomainMask, true).last
        guard let path = cachePath else { return "" }
        return path
    }
    
    static func documentUrl() -> URL {
        let documentUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).last
        guard let url = documentUrl else { return URL(fileURLWithPath: "")}
        return url
    }
}
